<?php
declare(strict_types=1);

namespace app\api\controller\login;
use app\common\service\Result;
class Login
{
    //账号密码登录
    public function login()
    {
        $data = input('post.');
        $validate = new \app\api\validate\User();
        if (!$validate->scene('login')->check($data)) {
            return Result::error($validate->getError());
        }
        $user = new \app\api\model\User();
        $res = $user->login($data);
        if ($res) {
            return Result::success('登录成功', $res);
        }
    }
}